﻿using Max.PH4_2104A.Shopping.DAL;
using Max.PH4_2104A.Shopping.Domain;
using Max.PH4_2104A.Shopping.IRepository;

namespace Max.PH4_2104A.Shopping.Repository
{
    /// <summary>
    /// 系统用户的仓储实现
    /// </summary>
    public class SystemUserRepository : ISystemUserRepository
    {
        MyDbContext _context;

        public SystemUserRepository(MyDbContext context)
        {
            _context = context;
        }

        //删除
        public void Delete(SystemUserModel model)
        {
            _context.SystemUsers.Remove(model);
        }

        //查询
        public IQueryable<SystemUserModel> GetAll()
        {
            return _context.SystemUsers;
        }

        //添加（没有返回值）
        public void Insert(SystemUserModel model)
        {
            _context.SystemUsers.Add(model);
            //_context.SaveChanges();
        }

        //修改
        public void Update(SystemUserModel model)
        {
            _context.SystemUsers.Update(model); 
        }
    }
}